package com.kerbores.blog.setup;

import org.nutz.dao.Dao;
import org.nutz.dao.util.Daos;
import org.nutz.lang.Lang;
import org.nutz.mvc.Mvcs;
import org.nutz.mvc.NutConfig;
import org.nutz.mvc.Setup;

import com.kerbores.blog.bean.User;
import com.kerbores.blog.bean.User.Level;

public class InitSetUp implements Setup {

	@Override
	public void init(NutConfig nc) {
		Daos.createTablesInPackage(Mvcs.getIoc().get(Dao.class, "dao"), "com.kerbores.blog.bean", false);
		User user = new User();
		user.setEmail("kerbores@dgj.com");
		user.setPassword(Lang.md5("123456"));
		user.setUserName("admin");
		user.setLevel(Level.ADMIN);
		Mvcs.getIoc().get(Dao.class, "dao").insert(user);
	}

	@Override
	public void destroy(NutConfig nc) {
		// TODO Auto-generated method stub

	}

}
